<?php
/**
 * Created by PhpStorm.
 * User: iamya
 * Date: 2017/10/10
 * Time: 10:22
 */

namespace app\circle\model;


class CircleMemberModel extends BaseModel
{
    protected $name = 'circle_circle_member'; //定义用户表
    //开启自动写入时间戳
    protected $autoWriteTimestamp = false;
    // 定义自动完成的属性
    protected $auto = []; //新增修改
    protected $insert = []; //插入
    protected $update = []; //修改
    protected $append=['member_info'];

    protected function getIsIdentityTextAttr($value,$data){
        $arr=[1=>'圈主',2=>'成员'];
        return $arr[$data['is_identity']];
    }

    protected function getCmStateTextAttr($value,$data){
        $arr=[0=>'申请中',1=>'通过',2=>' 未通过'];
        return $arr[$data['cm_state']];
    }

    protected function getMemberInfoAttr($value, $data)
    {
        $model=new MemberModel();
        return $model->where('member_id',$data['member_id'])->find();
    }
}